package com.boarsoft.boar.demo.tenant;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.boarsoft.boar.demo.tenant.entity.PocPost;
import com.boarsoft.boar.demo.tenant.service.PocPostService;
import com.boarsoft.common.Util;

public class Main {
	private static ClassPathXmlApplicationContext ctx;

	public static void main(String[] args) {
		ctx = new ClassPathXmlApplicationContext("classpath:conf/context.xml");
		System.out.println("Startup ".concat(ctx.isRunning() ? "successfully." : "failed."));

		String tenantId = "tenant0";
		String t = Util.getStdmfDateTime();
		PocPostService ps = ctx.getBean(PocPostService.class);
		PocPost o = new PocPost();
		o.setContent("content-".concat(t));
		o.setTitle(String.format("%s-%s", tenantId, t));
		ps.process(tenantId, o);
	}
}
